`timescale  1ns/1ns
module sanzi_tb ();


reg clk;
reg rst_n;
reg play;
reg pc;
reg [3:0]computer_position;
reg [3:0]player_position ;
wire [1:0] pos1,pos2,pos3,pos4,pos5,pos6,pos7,pos8,pos9;
wire [1:0] who;
wire even_score_flag;


always #50 clk = ~clk;
    
initial begin
    clk    <= 1'b1;
    rst_n  <= 1'b0;
    #20
    rst_n  <= 1'b1;
end
//??????????
// initial begin
//     #5000
//     play <= 1'b1;
//     pc   <= 1'b0;
//     player_position <= 4'd0;
//     computer_position <= 4'd10; 
//     #5000
//     play <= 1'b0;
//     pc   <= 1'b1;
//     computer_position <= 4'd6;
//     player_position <= 4'd10; 
//     #5000
//     play <= 1'b1;
//     pc   <= 1'b0;
//     player_position <= 4'd1;
//     computer_position <= 4'd10;
//     #5000
//     play <= 1'b0;
//     pc   <= 1'b1;
//     computer_position <= 4'd7;
//     player_position <= 4'd10;
//     #5000
//     play <= 1'b1;
//     pc   <= 1'b0;
//     player_position <= 4'd2;
//     computer_position <= 4'd10;
// end
//??????????
initial begin
    #5000
    play <= 1'b1;
    pc   <= 1'b0;
    player_position <= 4'd0;
    computer_position <= 4'd10; 
    #5000
    play <= 1'b0;
    pc   <= 1'b1;
    computer_position <= 4'd1;
    player_position <= 4'd10; 
    #5000
    play <= 1'b1;
    pc   <= 1'b0;
    player_position <= 4'd2;
    computer_position <= 4'd10;
    #5000
    play <= 1'b0;
    pc   <= 1'b1;
    computer_position <= 4'd3;
    player_position <= 4'd10;
    #5000
    play <= 1'b1;
    pc   <= 1'b0;
    player_position <= 4'd5;
    computer_position <= 4'd10;
    #5000
    play <= 1'b0;
    pc   <= 1'b1;
    computer_position <= 4'd4;
    player_position <= 4'd10;
    #5000
    play <= 1'b1;
    pc   <= 1'b0;
    player_position <= 4'd6;
    computer_position <= 4'd10;
    #5000
    play <= 1'b0;
    pc   <= 1'b1;
    computer_position <= 4'd8;
    player_position <= 4'd10;
    #5000
    play <= 1'b1;
    pc   <= 1'b0;
    player_position <= 4'd7;
    computer_position <= 4'd10;
end

tic_tac_toe_game    u_tic_tac_toe_game(
    . clock(clk),                     // ??
    . reset(rst_n),                     // ??
    . play(play),                      // ?????? 
    . pc(pc),                        // ??????
    . computer_position(computer_position),   // ????
    . player_position(player_position),     // player position to play
    
    . pos1(pos1), 
    . pos2(pos2), 
    . pos3(pos3), 
    . pos4(pos4),
    . pos5(pos5),
    . pos6(pos6),
    . pos7(pos7),
    . pos8(pos8),
    . pos9(pos9), 
                                    
    . who(who),            
                              
                               
    . even_score_flag (even_score_flag)     
);
    
endmodule